class Node:
    def __init__(self, val=None, children=None):
        self.val = val
        self.children = children

        
class Solution:
    def postorder(self, root: 'Node') -> List[int]:
        list = []
        def dfs(root):
            if not root:
                return
            for c in root.children:
                dfs(c)
            list.append(root.val)
        dfs(root)
        return list
